/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.wiredsys.credcheck.dao.factory;

import br.com.wiredsys.credcheck.dao.factory.intf.DAOFactoryIntf;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 *
 * @author ppacheco
 */
public class DAOFactory implements DAOFactoryIntf {
    
    public static DAOFactory instance = null;
    private static final Logger log = Logger.getLogger(DAOFactory.class.getName());

    /**
     * 
     */
    public DAOFactory() {
        log.log(Level.INFO, ">>>Loading DAOFactory >> Credcheck Application");
    }
    
    /**
     * 
     * @return instance
     * @throws InstantiationException 
     */
    public static DAOFactory getInstance() throws InstantiationException {
        
        try {
            if(instance == null) {
                log.log(Level.INFO, "Creating a new instance >> DAOFactory");
                instance = new DAOFactory();
            }
        } catch (Exception e) {
            log.log(Level.ERROR, e.getMessage(), e);
        }
        return instance;
    }
}
